<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<!-- remove old header -->


<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>cogen API Reference Documentation
        - Module: events</title><meta name="MSSmartTagsPreventParsing" content="true" /><meta http-equiv="imagetoolbar" content="no" /><link href="css/default.css" rel="stylesheet" type="text/css" /><link href="css/pygments.css" rel="stylesheet" type="text/css" />
    <!-- <link rel="shortcut icon" href="/images/favicon.ico" type="image/vnd.microsoft.icon"/> -->
    <link rel="stylesheet" href="css/apydia.css" type="text/css" />
    <script src="js/jquery-1.2.1.pack.js" type="text/javascript"></script>
    <script src="js/apydia.js" type="text/javascript"></script>
	<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
</head>
<body>
    <div id="page">
        <div id="browser">
            <div class="browser-section">
                <h2>Module Index</h2>
                <ul>
                    <li>
                        <a href="cogen.html">cogen</a>
                    </li><li>
                        <a href="cogen.common.html">cogen.common</a>
                    </li><li>
                        <a href="cogen.core.html">cogen.core</a>
                    </li><li>
                        <a href="cogen.core.coroutine.html">cogen.core.coroutine</a>
                    </li><li class="active">
                        <a href="cogen.core.events.html">cogen.core.events</a>
                    </li><li>
                        <a href="cogen.core.queue.html">cogen.core.queue</a>
                    </li><li>
                        <a href="cogen.core.reactors.html">cogen.core.reactors</a>
                    </li><li>
                        <a href="cogen.core.schedulers.html">cogen.core.schedulers</a>
                    </li><li>
                        <a href="cogen.core.sockets.html">cogen.core.sockets</a>
                    </li><li>
                        <a href="cogen.core.util.html">cogen.core.util</a>
                    </li><li>
                        <a href="cogen.web.html">cogen.web</a>
                    </li><li>
                        <a href="cogen.web.async.html">cogen.web.async</a>
                    </li><li>
                        <a href="cogen.web.wsgi.html">cogen.web.wsgi</a>
                    </li>
                </ul>
            </div>
            <div class="browser-section">
                <h2>Classes</h2>
                <ul>
                    <li>
                        <a href="cogen.core.events.AddCoro.html">AddCoro</a>
                    </li><li>
                        <a href="cogen.core.events.Call.html">Call</a>
                    </li><li>
                        <a href="cogen.core.events.ConnectionClosed.html">ConnectionClosed</a>
                    </li><li>
                        <a href="cogen.core.events.Join.html">Join</a>
                    </li><li>
                        <a href="cogen.core.events.OperationTimeout.html">OperationTimeout</a>
                    </li><li>
                        <a href="cogen.core.events.Signal.html">Signal</a>
                    </li><li>
                        <a href="cogen.core.events.Sleep.html">Sleep</a>
                    </li><li>
                        <a href="cogen.core.events.WaitForSignal.html">WaitForSignal</a>
                    </li>
                </ul>
            </div>
        </div>
        <div id="content">
    <h1>Module:
        cogen.core.events
    </h1>
    <div class="docstring plain">Base events (coroutine operations) and coroutine exceptions.</div>
    <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\core\events.py#L1">View source</a>
    </li>
</ul>
    <div>
        <h2>Classes</h2>
            <h3>
                <a href="cogen.core.events.AddCoro.html">AddCoro</a>
            </h3>
            <div class="docstring plain">A operator for adding a coroutine in the scheduler.
Example:<br /><br /><pre class="codeblock python python python python python python python python" name="code">
yield events.AddCoro(some_coro, args=(), kwargs={})
</pre></div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.core.events.AddCoro.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\core\events.py#L224">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.core.events.Call.html">Call</a>
            </h3>
            <div class="docstring plain">This will pause the current coroutine, add a new coro in the scheduler and
resume the callee when it returns.<br /><br />Usage:
<pre class="codeblock python python python python python python python python python" name="code">
result = yield events.Call(mycoro, args=&lt;a tuple&gt;, kwargs=&lt;a dict&gt;, prio=&lt;int&gt;)
</pre><ul><li> if <code name="code" class="python">prio</code> is set the new coroutine will be added in the top of the </li></ul><blockquote>scheduler queue</blockquote></div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.core.events.Call.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\core\events.py#L186">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.core.events.ConnectionClosed.html">ConnectionClosed</a>
            </h3>
            <div class="docstring plain">Raised when the other peer has closed connection.</div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.core.events.ConnectionClosed.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\core\events.py#L22">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.core.events.Join.html">Join</a>
            </h3>
            <div class="docstring plain">A operator for waiting on a coroutine.
Example:<br /><br /><pre class="codeblock python python python python python python python python python python" name="code">
@coroutine
def coro_a():
    return_value = yield events.Join(ref)
    
    
@coroutine
def coro_b():
    yield "bla"
    raise StopIteration("some return value")

ref = scheduler.add(coro_b)
scheduler.add(coro_a)
</pre></div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.core.events.Join.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\core\events.py#L305">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.core.events.OperationTimeout.html">OperationTimeout</a>
            </h3>
            <div class="docstring plain">Raised when the timeout for a operation expires. The exception
message will be the operation</div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.core.events.OperationTimeout.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\core\events.py#L25">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.core.events.Signal.html">Signal</a>
            </h3>
            <div class="docstring plain">This will resume the coroutines that where paused with WaitForSignal.<br /><br />Usage:<br /><br /><pre class="codeblock python python python python python python python python python python python" name="code">
nr = yield events.Signal(name, value)
</pre><ul><li> nr - the number of coroutines woken up</li></ul></div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.core.events.Signal.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\core\events.py#L137">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.core.events.Sleep.html">Sleep</a>
            </h3>
            <div class="docstring plain">Usage:<br /><br /><pre class="codeblock python python python python python python python python python python python python" name="code">
yield events.Sleep(time_object)
</pre><ul><li> timeoject - a datetime or timedelta object, or a number of seconds</li></ul><blockquote></blockquote><pre class="codeblock python python python python python python python python python python python python python" name="code">
yield events.Sleep(timestamp=ts)
</pre><ul><li> ts - a timestamp</li></ul></div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.core.events.Sleep.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\core\events.py#L341">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.core.events.WaitForSignal.html">WaitForSignal</a>
            </h3>
            <div class="docstring plain">The coroutine will resume when the same object is Signaled.</div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.core.events.WaitForSignal.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\core\events.py#L104">View source</a>
    </li>
</ul>
    </div>
        </div>
        <div id="footer">
            Generated with <a href="http://apydia.ematia.de/" class="extern">
            Apydia 0.0.3</a>
        </div>
    </div>
</body>
</html>